<?php

namespace app\admin\model\validate;

use think\Validate;

class WechatUser extends Validate {
    protected $rule =   [
        'nick_name'  => 'require|max:40',
        'openid'   => 'max:64|unique:wechat_user',
        'avatar_url' => 'require|max:196',
        'gender' => 'require|number',
        'country' => 'max:24',
        'province' => 'max:32',
        'city' => 'max:32',
        'language' => 'max:24',
        //'remainder' => 'number',
        //'type' => 'require|number',
        //'status' => 'require|number',
    ];

    protected $message  =   [
        'nick_name.require' => '昵称不能为空',
        'nick_name.max'     => '昵称最多不能超过40个字符',
        //'openid.require'   => 'OPEN ID不能为空',
        'openid,unique'  => '该OPEN ID已经存在',
        'openid.max'  => 'OPEN ID不能超过64个字符',
        'gender.require'   => '性别不能为空',
        'gender.number'    => '性别数据有误',
        'avatar_url.max'    => '头像url不能超过196个字符',
        'avatar_url.require'   => '头像必须存在',
        'country.max'    => '国家名不能超过24个字符',
        'province.max'    => '省名不能超过32个字符',
        'city.max'    => '城市名不能超过32个字符',
        'language.max' => '语言不能超过24个字符',
        //'remainder.number' => '剩余抽卡次数必须是数字',
        //'award.number' => '红包金额必须是数字',
        //'status.require' => '状态不能为空'
    ];

    protected $scene = [
        /*'add'  =>  ['name','theme','start_time', 'end_time', 'attention_tips', 'cover_image_url', 'sort', 'participate_num'],
        'edit'  =>  ['name','theme','start_time', 'end_time', 'attention_tips', 'cover_image_url', 'sort', 'participate_num'],*/
    ];
}